library(rjson)
js1 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test_incl.json")
js2 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test__1.json")
for(i in 1:length(js1$InclusionRules)) {
if(js1$InclusionRules[[i]]["name"] %in% c('test1',"test2")) {
js2$InclusionRules[[i]] <- append(js2$InclusionRules, js1$InclusionRules[[i]])
includedConceptId <- js1$InclusionRules[[i]]$expression$CriteriaList[[1]][[1]][[1]][[1]]
if(js1$ConceptSets[[i]]$id %in% includedConceptId) {
js2$ConceptSets[[i]] <- append(js1$ConceptSets, js1$ConceptSets[[i]])
}
}
}
################################### 2 d
library(rjson)
js1 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test_incl.json")
js2 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test__1.json")
conceptIds <- c()
for(i_1 in 1:length(js2$ConceptSets)){
conceptId <- js2$ConceptSets[[i_1]][[1]]
conceptIds <- append(conceptIds, conceptId)
}
maxNumber <- max(conceptIds)
lengthOfIR <- length(js2$InclusionRules)
lengthOfConceptSets <- length(js2$ConceptSets)
for(i in 1:length(js1$InclusionRules)) {
if(js1$InclusionRules[[i]]["name"] %in% c("test3")) {
js2$InclusionRules[[lengthOfIR + 1]] <- append(
js1$InclusionRules,
js1$InclusionRules[[i]])
includedConceptIds <- c()
for(char in 1:length(js1$InclusionRules[[i]])) {
includedConceptIds <- append(
includedConceptIds,
js1$InclusionRules[[i]]$expression$CriteriaList[[char]][[1]][[1]][[1]]
)
}
for(setN in 1:length(js1$ConceptSets)) {
for(id in includedConceptIds) {
################################################################################
if(js1$ConceptSets[[setN]][[1]] %in% includedConceptIds) {
setToInput <- js1$ConceptSets[[setN]]
js2$ConceptSets[[lengthOfConceptSets + 1]] <- append(
js1$ConceptSets,
setToInput
)
lengthOfConceptSets <- lengthOfConceptSets + 1
IRID <- which(includedConceptIds == id)
js2$ConceptSets[[lengthOfConceptSets]]$id <- maxNumber + IRID
js2$InclusionRules[[lengthOfIR + 1]]$expression$CriteriaList[[IRID]][[1]][[1]][[1]] <- maxNumber + IRID
}
}
}
}
}
######################################## 3d ####################################################
library(rjson)
js1 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test_incl.json")
js2 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test__1.json")
conceptIds <- c()
for(i_1 in 1:length(js2$ConceptSets)){
conceptId <- js2$ConceptSets[[i_1]][[1]]
conceptIds <- append(conceptIds, conceptId)
}
maxNumber <- max(conceptIds)
lengthOfIR <- length(js2$InclusionRules)
lengthOfConceptSets <- length(js2$ConceptSets)
for(i in 1:length(js1$InclusionRules)) {
if(js1$InclusionRules[[i]]["name"] %in% c("test3")) {
js2$InclusionRules[[lengthOfIR + 1]] <- append(
js1$InclusionRules,
js1$InclusionRules[[i]])
includedConceptIds <- c()
for(char in 1:length(js1$InclusionRules[[i]])) {
includedConceptIds <- append(
includedConceptIds,
js1$InclusionRules[[i]]$expression$CriteriaList[[char]][[1]][[1]][[1]]
)
}
for(setN in 1:length(js1$ConceptSets)) {
for(id in includedConceptIds) {
if(js1$ConceptSets[[setN]][[1]] == id) {
setToInput <- js1$ConceptSets[[setN]]
js2$ConceptSets[[length(js2$ConceptSets) + 1]] <- append(
js1$ConceptSets,
setToInput
)
IRID <- which(includedConceptIds == id)
js2$ConceptSets[[lengthOfConceptSets + IRID]]$id <- maxNumber + IRID
js2$InclusionRules[[lengthOfIR + 1]]$expression$CriteriaList[[IRID]][[1]][[1]][[1]] <- maxNumber + IRID
}
}
}
}
}
js12 <- RJSONIO::toJSON(js2)
write(js12, "test111333.json")
#===========================================4th===================
library(rjson)
js1 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test_incl.json")
js2 <- rjson::fromJSON(file = "C:/Users/Alex/D/projects/ODYPACK/test__1.json")
conceptIds <- c()
for(i_1 in 1:length(js2$ConceptSets)){
conceptId <- js2$ConceptSets[[i_1]][[1]]
conceptIds <- append(conceptIds, conceptId)
}
maxNumber <- max(conceptIds)
lengthOfIR <- length(js2$InclusionRules)
lengthOfConceptSets <- length(js2$ConceptSets)
for(i in 1:length(js1$InclusionRules)) {
if(js1$InclusionRules[[i]]["name"] %in% c("test1")) {
js2$InclusionRules[[lengthOfIR + 1]] <- append(
js1$InclusionRules,
js1$InclusionRules[[i]])
includedConceptIds <- c()
for(char in 1:length(js1$InclusionRules[[i]])) {
idToInput <- try(js1$InclusionRules[[i]]$expression$CriteriaList[[char]][[1]][[1]][[1]], silent = T)
includedConceptIds <- append(
includedConceptIds,
idToInput
)
}
for(setN in 1:length(js1$ConceptSets)) {
for(id in includedConceptIds) {
if(js1$ConceptSets[[setN]][[1]] == id) {
setToInput <- js1$ConceptSets[[setN]]
js2$ConceptSets[[length(js2$ConceptSets) + 1]] <- append(
js1$ConceptSets,
setToInput
)
IRID <- which(includedConceptIds == id)
js2$ConceptSets[[lengthOfConceptSets + IRID]]$id <- maxNumber + IRID
js2$InclusionRules[[lengthOfIR + 1]]$expression$CriteriaList[[IRID]][[1]][[1]][[1]] <- maxNumber + IRID
}
}
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.